﻿<%@ Page Language="C#" MasterPageFile="AdminMasterPage.master" ValidateRequest="false" AutoEventWireup="true" CodeFile="LinkDirectoryAdmin.aspx.cs" Inherits="pages_LinkDirectory" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:DetailsView ID="DetailsView1" runat="server" Height="175px" Width="358px" 
        AllowPaging="True" AutoGenerateRows="False" DataKeyNames="id" 
        DataSourceID="SqlDataSource1">
        <Fields>
            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" 
                ReadOnly="True" SortExpression="id" />
            <asp:BoundField DataField="title" HeaderText="title" SortExpression="title" />
            <asp:TemplateField HeaderText="linkdesc" SortExpression="linkdesc">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Height="150px" 
                        Text='<%# Bind("linkdesc") %>' Width="300px" TextMode="MultiLine"></asp:TextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Height="150px" 
                        Text='<%# Bind("linkdesc") %>' Width="300px" TextMode="MultiLine"></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("linkdesc") %>' 
                        Width="300px"></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="date" HeaderText="date" SortExpression="date" />
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
                ShowInsertButton="True" />
        </Fields>
    </asp:DetailsView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:Personal %>" 
        DeleteCommand="DELETE FROM [LinkStore] WHERE [id] = @id" 
        InsertCommand="INSERT INTO [LinkStore] ([title], [linkdesc], [date]) VALUES (@title, @linkdesc, @date)" 
        SelectCommand="SELECT * FROM [LinkStore]" 
        UpdateCommand="UPDATE [LinkStore] SET [title] = @title, [linkdesc] = @linkdesc, [date] = @date WHERE [id] = @id">
        <DeleteParameters>
            <asp:Parameter Name="id" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="linkdesc" Type="String" />
            <asp:Parameter Name="date" Type="DateTime" />
            <asp:Parameter Name="id" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="title" Type="String" />
            <asp:Parameter Name="linkdesc" Type="String" />
             <asp:Parameter Name="date" Type="DateTime" />
        </InsertParameters>
    </asp:SqlDataSource>
</asp:Content>

